﻿<%@ Page Language="C#" MasterPageFile="~/Template.master" AutoEventWireup="true"
    CodeFile="Customer.aspx.cs" Inherits="CustomerPage" Title="Ghasam Co." %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    
    <div style="clear: both; padding: 0 0 10px 0; height: 80px;">
        <h3>لیست مشتریان</h3>
        <br />
        <br />
        <div style="float: right; width: 350px;">
            نام مشتری
            &nbsp;&nbsp;
            <asp:TextBox ID="txtSearchCustomerName" Height="12" runat="server" />
            &nbsp;&nbsp;
            <button id="btnSearch" runat="server" onserverclick="btnSearch_Click" style="height:20px; font-family:Tahoma; font-size:11px;" type="button">جستجو</button>
        </div>
        <div id="divHiddenCustomers" style="float: right; width: 400px;" runat="server">
            <asp:RadioButton ID="rbFormalCustomers" GroupName="rbCustomers" AutoPostBack="true"
                Text="گروه الف" runat="server" Checked="true" OnCheckedChanged="rbFormalCustomers_CheckedChanged" />
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:RadioButton ID="rbHiddenCustomers" GroupName="rbCustomers" AutoPostBack="true"
                Text="گروه ب" runat="server" OnCheckedChanged="rbHiddenCustomers_CheckedChanged" />
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:RadioButton ID="rbAll" GroupName="rbCustomers" AutoPostBack="true"
                Text="همه مشتریان" runat="server" OnCheckedChanged="rbAll_CheckedChanged" />
        </div>
    </div>
    <hr />
    <mani:PagingGridView ID="gvCustomers" runat="server" VirtualItemCount="-1" PageSize="15"
        AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ID" OnPageIndexChanging="gvCustomers_PageIndexChanging" OnSelectedIndexChanging="gvCustomers_SelectedIndexChanging" OnRowDeleting="gvCustomers_RowDeleting">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="کد" Visible="false" />
            <asp:BoundField DataField="CustomerName" HeaderText="نام مشتری" />
            <asp:TemplateField HeaderText="تراز مالی">
                <itemtemplate>
                     <%# UIHelper.FormatString(Eval("Balance")) %>        
                </itemtemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="مبلغ هشدار">
                <itemtemplate>
                    <%# UIHelper.FormatString(Eval("WarningPrice")) %>        
                </itemtemplate>
            </asp:TemplateField>
            <asp:CheckBoxField DataField="IsFormal" HeaderText="گروه الف" />
            <asp:CheckBoxField DataField="IsActive" HeaderText="فعال" />
            <asp:TemplateField HeaderText="آخرین زمان ویرایش">
                <itemtemplate>
                    <%# MyPersianDate.DateTimeToPersian(Eval("LastUpdate"))  %>
                </itemtemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <itemtemplate>
                        <asp:LinkButton ID="EditCustomer" runat="server" CausesValidation="False" CommandName="Select">
                                <img src="App_Themes/<%=Page.Theme %>/images/edit.gif" alt="" style="border:0;" />
                        </asp:LinkButton>
                    </itemtemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <itemtemplate>
                        <asp:LinkButton ID="DeleteCustomer" runat="server" CausesValidation="False" CommandName="Delete">
                                <img src="App_Themes/<%=Page.Theme %>/images/delete.gif" alt="" style="border:0;" />
                        </asp:LinkButton>
                    </itemtemplate>
            </asp:TemplateField>
        </Columns>
    </mani:PagingGridView>
    
    <br />  
    <br />
    
    <div id="formcontainer">
        <div>
            <label>کد مشترک</label>
            <asp:TextBox ID="txtCustomerId" ReadOnly="true" runat="server" />
        </div>
        
        <div>
            <label>نام مشتری</label>
            <asp:TextBox ID="txtCustomerName" MaxLength="150" runat="server" />
            <asp:RequiredFieldValidator ID="rfvCustomerName" ControlToValidate="txtCustomerName" ErrorMessage="*" runat="server" />
        </div>
        
        <div>
            <label>گروه الف</label>
            <asp:CheckBox ID="cbIsFormal" runat="server" />
        </div>
        
        <div>
            <label>مبلغ هشدار</label>
            <asp:TextBox ID="txtWarningPrice" runat="server" />
        </div>
        
        <div>
            <label>تلفن</label>
            <asp:TextBox ID="txtPhone" MaxLength="50" runat="server" />
        </div>
        
        <div>
            <label>آدرس</label>
            <asp:TextBox ID="txtAddress" TextMode="MultiLine" Width="400" MaxLength="300" runat="server" />
        </div>
        
        <div>
            <label>فعال</label>
            <asp:CheckBox ID="cbIsActive" Checked="true" runat="server" />
        </div>
        
        <div>
            <label>توضیحات</label>
            <asp:TextBox ID="txtComment" MaxLength="200" Width="400" TextMode="MultiLine" runat="server" />
        </div>
        
        <div>
            <label>تاریخ ایجاد</label>
            <asp:TextBox ID="txtCreateDate" ReadOnly="true" runat="server" />
        </div>
        
        <div>
            <label>آخرین ویرایش</label>
            <asp:TextBox ID="txtLastUpdate" ReadOnly="false" runat="server" />
        </div>
        
        <div>
            <button id="btnSave" runat="server" style="height:20px; font-family:Tahoma; font-size:11px;" type="button" onserverclick="btnSave_ServerClick">ذخیره</button>
            <button id="btnClear" runat="server" style="height:20px; font-family:Tahoma; font-size:11px;" type="button" onserverclick="btnClear_ServerClick">انصراف</button>
            
        </div>
    </div>

</asp:Content>
